import re

# max len of word hypothesis
WINSIZE = 11

# ibv parameters
IBV_SINGLE = 0.5

# ebv parameters
EBV_LEARNING_RATE = 0.3
EBV_SHARP_ADDITION = 0.001
EBV_EPS = 1E-2

# word rank parameters
# for f_poly
SCALE = 32.0
ALPHA = 6.3
DELTA = 6.9
# for f_exp
# SCALE = 64.0
# ALPHA = 2.1
# DELTA = 15.6

EBV_INIT_COUNT_PATH = 'output/ebv_init_count.txt'
MI_MODEL_PATH = 'output/mi_model.txt'

def is_word(word):
    return re.search("[iI6R3uUaA#O%E&e97Qo()*]", word) and len(word) > 1 or word in ["6", "9", "e", "o", "i", "%", "*", "(", "#"]

def word_rank(lbv, rbv, ibv):
    ibv = max(ibv + DELTA, 0.0)
    return SCALE * lbv * rbv * (ibv ** ALPHA) # f_poly
    return SCALE * lbv * rbv * (ALPHA ** ibv) # f_exp
